package com.tianhui.consignortwofei.mvp.model.hetong;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.ContractApiService;


import java.util.Map;

import io.reactivex.ObservableTransformer;

/**
 * @author fgs
 * @date 2020/8/27
 * @description
 **/
public class ContractModel<T> extends CommonModel<T> {

    /**
     * 发布货源
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void contractAddModel(Context context, ContractInfo info, boolean isDialog,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).contractAdd(info), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void bankAccountLisModel(Context context, Map<String, String> map, boolean isDialog,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).bankAccountList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void authorizedRepresentativeListModel(Context context, Map<String, String> map, boolean isDialog,
                                                  ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).authorizedRepresentativeList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机信息
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void companyFirstPartyListModel(Context context, boolean isDialog,
                                           ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).companyFirstPartyList(), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void companyPartyBListModel(Context context, Map<String, String> map, boolean isDialog,
                                       ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).companyPartyBList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void sealUnitListModel(Context context, Map<String, String> map, boolean isDialog,
                                  ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).sealUnitList(), observerListener, transformer, isDialog, true);
    }

    /**
     * 生成
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void createContractModel(Context context, Map<String, String> map, boolean isDialog,
                                  ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).createContract(map), observerListener, transformer, isDialog, true);
    }



    /**
     * 搜索合同单号
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getBianHaoResult(Context context, Map<String, String> map, boolean isDialog,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(ContractApiService.class).getBianHaoResult(map), observerListener, transformer, isDialog, true);
    }




}
